import { request } from '@/utils/request.js'

export default {

  /**
   * 用户列表
   * @param {*} data
   * @returns
   */
  listUser(data) {
    return request({
      url: '/admin/user/userList',
      method: 'post',
      data
    })
  },
  /**
   * 数据列表
   * @returns
   */
  getPageList(params = {}) {
    return request({
      url: '/app/saiuser/user/AppUser/index',
      method: 'get',
      params
    })
  },

  /**
   * 添加数据
   * @returns
   */
  save(params = {}) {
    return request({
      url: '/app/saiuser/user/AppUser/save',
      method: 'post',
      data: params
    })
  },

  /**
   * 读取数据
   * @returns
   */
  read(id) {
    return request({
      url: '/app/saiuser/user/AppUser/read?id=' + id,
      method: 'get'
    })
  },

  /**
   * 软删除数据
   * @returns
   */
  delete(data) {
    return request({
      url: '/app/saiuser/user/AppUser/destroy',
      method: 'delete',
      data
    })
  },

  /**
   * 更新数据
   * @returns
   */
  update(id, data = {}) {
    return request({
      url: '/app/saiuser/user/AppUser/update?id=' + id,
      method: 'put',
      data
    })
  },

  /**
   * 更改状态
   * @returns
   */
  changeStatus(data = {}) {
    return request({
      url: '/app/saiuser/user/AppUser/changeStatus',
      method: 'post',
      data
    })
  },

  /**
   * 用户充值
   * @returns
   */
  recharge(id, data = {}) {
    return request({
      url: '/app/saiuser/user/AppUser/recharge?id=' + id,
      method: 'post',
      data
    })
  },

  /**
   * 初始化用户密码
   * @returns
   */
  initUserPassword(data) {
    return request({
      url: '/app/saiuser/user/AppUser/password',
      method: 'post',
      data
    })
  },
  // 消费等级列表
  getLevelList() {
    return request({
      url: '/admin/level/index',
      method: 'get'
    })
  },
  // 新增消费等级
  addLevel(data = {}) {
    return request({
      url: '/admin/level/save',
      method: 'post',
      data
    })
  },
  // 编辑消费等级
  editLevel(data = {}) {
    return request({
      url: '/admin/level/update',
      method: 'PUT',
      data
    })
  },
  // 充值类型
  RechargeTypeList() {
    return request({
      url: '/admin/user/rechargeType',
      method: 'post'
    })
  },
  // 充值
  Recharge(data = {}) {
    return request({
      url: '/admin/user/recharge',
      method: 'post',
      data
    })
  },
  // 用户编辑
  Edit(data = {}) {
    return request({
      url: '/admin/user/userEdit',
      method: 'post',
      data
    })
  },
  // 用户操作
  // 操作
  Operation(data = {}) {
    return request({
      url: '/admin/user/stateCommunityUser',
      method: 'post',
      data
    })
  },
  // 清除团长
  clearCommunityInfo(data = {}) {
    return request({
      url: '/admin/user/clearCommunityInfo',
      method: 'post',
      data
    })
  },
  // 可切换身份列表
  identityList(data = {}) {
    return request({
      url: '/admin/user/migrationList',
      method: 'post',
      data
    })
  },
  // 切换身份
  identityUpdate(data = {}) {
    return request({
      url: '/admin/user/migrationUser',
      method: 'post',
      data
    })
  }
}